<!--edit by kim-->
<form method="POST" action="index.php?app=b2c&ctl=admin_business_basicmsg&act=editmsg" class="tableform" id="BBFORM">
<div class="tableform">
	<div class="division">
		<table>
		<input type="hidden" name="bid" value=<{$msg.business_id}>>
			<tbody>
				<tr>
					<th><em class="c-red">*</em><{t}>中文全称：<{/t}></th>
					<td><{input type="text" name="business[chinese_all_name]" size="20" style="width:200px" vtype="required" value=$msg.chinese_all_name}></td>
				</tr>
				<tr>
					<th><em class="c-red">*</em><{t}>英文全称：<{/t}></th>
					<td><{input type="text" name="business[english_all_name]" size="20" style="width:200px" vtype="required" value=$msg.english_all_name}></td>
				</tr>
				<tr>
					<th><{t}>在俄公司名称：<{/t}></th>
					<td><{input type="text" name="business[russia_all_name]" size="20" style="width:200px" value=$msg.russia_all_name}></td>
				</tr>
				<tr>
					<th><{t}>公司地址：<{/t}></th>
					<td>
					<{input app=ectools type="region"  name="business[company_area]" vtype='area' value=$msg.company_area}><span class="field_notice"></span>
					</td>
				</tr>
				<tr>
					<th>&nbsp;&nbsp;&nbsp;&nbsp; </th>
					<td>
					<{input  type="text"  name="business[company_addr]" size="40"  value=$msg.company_addr}></span>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
<!--第一联系人信息-->
	<div class="division">
		<tbody>
			<table>
			<tr><th><{t}>第一联系人<{/t}><th><td></td></tr>
			<tr>
			  <th><em class="c-red">*</em><{t}>联系人姓名(俄语)：<{/t}></th>
			  <td><{input type="text" name="business[company_rname1]" style="width:200px" size="20" vtype="required" value=$msg.company_rname1}></td>
			</tr>
			<tr>
			  <th><em class="c-red">*</em><{t}>联系人姓名(汉语)：<{/t}></th>
			  <td><{input type="text" name="business[company_cname1]" style="width:200px" size="20" vtype="required" value=$msg.company_cname1}></td>
			</tr>
			<tr>
			<th><em class="c-red">*</em><{t}>联系人电话：<{/t}></th>
			  <td style="width:350px;">
			  <{if $phones}>
				<select name="business[phone_setting1]" id="quhao" onchange="checkPerfix(this)">
					<{foreach from=$phones item=items}>
						<option sid="<{$items.length}>" value="<{$items.area}>"<{if $items.area == $msg.phone_setting1}>selected="selected"<{/if}>><{$items.country}><{$items.area}></option>
					<{/foreach}>
				</select>
			  <{/if}>
			  <{input type="text" name="business[company_tel1]" id="mobile" style="width:200px" size="20" vtype="required" value=$msg.company_tel1  onchange="telCheck(this)"}><span></span></td>
			</tr>
			<tr>
			  <th><{t}>联系人微信：<{/t}></th>
			  <td><{input type="text" name="business[company_weixin1]" style="width:110px" size="20" value=$msg.company_weixin1}></td>
			</tr>
			</table>
		</tbody>
	</div>
<!--第二联系人信息-->
	<div class="division">
		<tbody>
			<table>
			<tr><th><{t}>第二联系人<{/t}><th><td></td></tr>
			<tr>
			  <th><{t}>联系人姓名(俄语)：<{/t}></th>
			  <td><{input type="text" name="business[company_rname2]" style="width:200px" size="20"  value=$msg.company_rname2}></td>
			</tr>
			<tr>
			  <th><{t}>联系人姓名(汉语)：<{/t}></th>
			  <td><{input type="text" name="business[company_cname2]" style="width:200px" size="20"  value=$msg.company_cname2}></td>
			</tr>
			<tr>
			  <th><{t}>联系人电话：<{/t}></th>
			  <td style="width:350px;">
			  <{if $phones}>
				<select name="business[phone_setting2]" id="quhao2" onchange="checkPerfix2(this)">
					<{foreach from=$phones item=items}>
					<option sid="<{$items.length}>" value="<{$items.area}>"<{if $items.area == $msg.phone_setting2}>selected="selected"<{/if}>><{$items.country}><{$items.area}></option>
					<{/foreach}>
				</select>
			  <{/if}>
			  <{input type="text" name="business[company_tel2]" id="mobile2" style="width:110px" size="20" value=$msg.company_tel2  onchange="telCheck2(this)"}><span></span></td>
			</tr>
			<tr>
			  <th><{t}>联系人微信：<{/t}></th>
			  <td><{input type="text" name="business[company_weixin2]" style="width:200px" size="20"  value=$msg.company_weixin2}></td>
			</tr>
			<tr>
			  <th><{t}>其他联系方式：<{/t}></th>
			  <td><{input type="text" name="business[others_contact]" style="width:200px" size="20"  value=$msg.others_contact}></td>
			</tr>
			</table>
		</tbody>
	</div>
	<div class="division">
		<tbody>
			<table>
			<tr>
				<th><{t}>出货仓库类型：<{/t}></th>
				<td><input type="radio" name="business[depot_type]" value=0 <{if $msg.depot_type==0}>checked<{/if}>><{t}>Lublino<{/t}>
				<input type="radio" name="business[depot_type]" value=1 <{if $msg.depot_type==1}>checked<{/if}>><{t}>HY仓库<{/t}>
				<input type="radio" name="business[depot_type]" value=2 <{if $msg.depot_type==2}>checked<{/if}>><{t}>其他<{/t}></td>
			</tr>
			<tr>
				<th><{t}>出货仓库地址：<{/t}></th>
				<td><{input type="text" name="business[depot_addr]" style="width:200px" size="20"  value=$msg.depot_addr}></td>
			</tr>
			<tr>
				<th><{t}>Lublino店铺编号：<{/t}></th>
				<td><{input type="text" name="business[lnumber]" style="width:200px" size="20" value=$msg.lnumber}></td>
			</tr>
			<tr>
				<th><{t}>商检证到期日期：<{/t}></th>
				<td><{if $msg.check_time}><{input type="date" name="business[check_time]" value=$msg.check_time|cdate:FDATE}><{else}><{input type="date" name="business[check_time]"}><{/if}></td>
			</tr>
			<tr>
				<th><{t}>是否有代理授权：<{/t}></th>
				<td><input type="radio" name="business[is_agency]" value=true <{if $msg.is_agency=="true"}>checked<{/if}>><{t}>是<{/t}>
				<input type="radio" name="business[is_agency]" value=false <{if $msg.is_agency=="false"}>checked<{/if}>><{t}>否<{/t}></td>
			</tr>
			<tr>
				<th><{t}>CRM客户编码：<{/t}></th>
				<td><{input type="text" name="business[crm_number]" style="width:200px" size="20" value=$msg.crm_number}></td>
			</tr>
			<tr>
				<th><{t}>是否为物流客户：<{/t}></th>
				<td><input type="radio" name="business[is_wuliu]" value=true <{if $msg.is_wuliu=="true"}>checked<{/if}>><{t}>是<{/t}>
				<input type="radio" name="business[is_wuliu]" value=false <{if $msg.is_wuliu=="false"}>checked<{/if}>><{t}>否<{/t}></td>
			</tr>
			<tr>
				<th><{t}>库存确认：<{/t}></th>
				<td><input type="radio" name="business[is_share]" value=true <{if $msg.is_share=="true"}>checked<{/if}>><{t}>需要<{/t}>
				<input type="radio" name="business[is_share]" value=false <{if $msg.is_share=="false"}>checked<{/if}>><{t}>不需要<{/t}></td>
			</tr>
			</table>
		</tbody>
	</div>
</div>
<div class="table-action">
	<{button type="submit"  label=$___b2c="保存"|t:'b2c'}>
</div>
</form>
<script>
$('BBFORM').store('target',{
//	onComplete:function(){
//		if(opener.finderGroup['<{$env.get._finder.finder_id}>'])
//		opener.finderGroup['<{$env.get._finder.finder_id}>'].refresh();
//		window.close();
//	}
	onComplete:function(rs){
		var json;
		json = JSON.validate(rs) ? JSON.decode(rs) : null;
		if(json && json.success){
			window.close();
		}
	}
});

function telCheck(input){
	var obj = $$("#quhao option:selected");
	var phone_setting = '';
	var len = '';
	if(obj && obj[0])
	{
		phone_setting = obj[0].value.replace("+","%2B");
		len = obj[0].get('sid');
	}

	new Request({
		url:'<{link app=b2c ctl=admin_operator_member act=check_tel2}>',
		method:'post',
		data:'mobile='+input.value.trim()+"&phone_setting="+phone_setting+'&len='+len,
		onSuccess: function(rs) {
			rs = JSON.decode(rs);
			if(rs.error) {
				input.getNext().innerHTML = '<span class="error caution notice-inline">' +rs.error + '</span>';
			}
			else if(rs.success) {
				input.getNext().innerHTML = '<span class="success notice-inline">' +rs.success + '</span>';
			}
		}
	}).send();
}

function telCheck2(input){
	var obj = $$("#quhao2 option:selected");
	var phone_setting = '';
	var len = '';
	if(obj && obj[0])
	{
		phone_setting = obj[0].value.replace("+","%2B");
		len = obj[0].get('sid');
	}

	new Request({
		url:'<{link app=b2c ctl=admin_operator_member act=check_tel2}>',
		method:'post',
		data:'mobile='+input.value.trim()+"&phone_setting="+phone_setting+'&len='+len,
		onSuccess: function(rs) {
			rs = JSON.decode(rs);
			if(rs.error) {
				input.getNext().innerHTML = '<span class="error caution notice-inline">' +rs.error + '</span>';
			}
			else if(rs.success) {
				input.getNext().innerHTML = '<span class="success notice-inline">' +rs.success + '</span>';
			}
		}
	}).send();
}

function checkPerfix(obj){
	var phone_setting = obj.get('value');
	var input = $('mobile');
	var mobile = input.get('value');
	var o = $$("#quhao option:selected");
	if(o && o[0])
	{
		var len = o[0].get('sid');
	}
	new Request({
		url:'<{link app=b2c ctl=admin_operator_member act=check_tel2}>',
		method:'post',
		data:'mobile='+mobile+"&phone_setting="+phone_setting+'&len='+len,
		onSuccess: function(rs) {
			rs = JSON.decode(rs);
			if(rs.error) {
				input.getNext().innerHTML = '<span class="error caution notice-inline">' +rs.error + '</span>';
			}
			else if(rs.success) {
				input.getNext().innerHTML = '<span class="success notice-inline">' +rs.success + '</span>';
			}
		}
	}).send();
}

function checkPerfix2(obj){
	var phone_setting = obj.get('value');
	var input = $('mobile2');
	var mobile = input.get('value');
	var o = $$("#quhao option:selected");
	if(o && o[0])
	{
		var len = o[0].get('sid');
	}
	new Request({
		url:'<{link app=b2c ctl=admin_operator_member act=check_tel2}>',
		method:'post',
		data:'mobile='+mobile+"&phone_setting="+phone_setting+'&len='+len,
		onSuccess: function(rs) {
			rs = JSON.decode(rs);
			if(rs.error) {
				input.getNext().innerHTML = '<span class="error caution notice-inline">' +rs.error + '</span>';
			}
			else if(rs.success) {
				input.getNext().innerHTML = '<span class="success notice-inline">' +rs.success + '</span>';
			}
		}
	}).send();
}
</script>